package com.neuedu.service.impl;

import com.neuedu.common.JSONData;
import com.neuedu.dao.SpecsValMapper;
import com.neuedu.pojo.SpecsVal;
import com.neuedu.service.SpecsValService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service(value = "specsValService")
public class SpecsValServiceImpl implements SpecsValService {
    @Autowired
    private SpecsValMapper specsValMapper;

    public JSONData<String> saveOrUpdateSpecsVal(SpecsVal specsVal) {
        int num = 0;
        if(specsVal.getId()==null){
            num = specsValMapper.insert(specsVal);
        }else{
            num = specsValMapper.updateByPrimaryKey(specsVal);
        }
        if(num>0){
            return JSONData.buildSuccess("规格值信息操作成功");
        }
        return JSONData.buildError("规格值信息操作失败");
    }
}
